package com.msk86.ygoroid.newaction.dueldisk.actionimpl;

import android.app.AlertDialog;
import android.content.DialogInterface;
import com.ygo.feihua.R;
import com.msk86.ygoroid.newop.Operation;
import com.msk86.ygoroid.newutils.Utils;
import com.ygo.feihua.*;
import android.view.*;
import android.widget.*;
import android.view.View.*;

public class ExitConfirmAction extends BaseAction {
    public ExitConfirmAction(Operation operation) {
        super(operation);
    }

    @Override
    public void execute() {
		/*
		final Gongju gj=new Gongju(Utils.getContext());
		View[] v=gj.dialogt(false,"",Utils.s(R.string.QUIT));
		
		Button b1,b2;
		b1=(Button) v[0];
		b2=(Button) v[1];
		b1.setText(Utils.s(R.string.CONFIRM_NO));
		b2.setText(Utils.s(R.string.CONFIRM_YES));
		
		b1.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View p1)
				{
					gj.dis();
					// TODO: Implement this method
				}
			});
		b2.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View p1)
				{
					gj.dis();
					
					Utils.getContext().finish();
					// TODO: Implement this method
				}
			});*/
		
       AlertDialog dialog = new AlertDialog.Builder(Utils.getContext())
                .setTitle(Utils.s(R.string.QUIT))
                .setPositiveButton(Utils.s(R.string.CONFIRM_YES), new OnExitClickListener("OK"))
                .setNegativeButton(Utils.s(R.string.CONFIRM_NO), new OnExitClickListener("Cancel"))
                .create();
        dialog.show();
    }

    private static class OnExitClickListener implements DialogInterface.OnClickListener {
        private String button;

        public OnExitClickListener(String button) {
            this.button = button;
        }

        @Override
        public void onClick(DialogInterface dialogInterface, int i) {
            if ("OK".equals(button)) {
                
              /*  android.os.Process.killProcess(android.os.Process.myPid());
                System.exit(0)*/
				
				Utils.getContext().finish();
				
            }
        }
    }
}
